﻿// SignalDoorContactOpenCommand
// Command for signaling open scanner housing door
// 
// FLMScan - Featured by FabLab Munich

using System;
using System.Windows.Input;

namespace FLMScan.Commands
{
    internal class SignalDoorContactOpenCommand : ICommand
    {
        private FLMScanViewModel viewModel;
        private StateMachine stateMachine;

        public SignalDoorContactOpenCommand(FLMScanViewModel viewModel, StateMachine stateMachine)
        {
            this.viewModel = viewModel;
            this.stateMachine = stateMachine;
        }

        public void Execute(object parameter)
        {
            String text = (String)parameter;

            viewModel.OnSignalDoorContactOpenCommand();
        }

        public bool CanExecute(object parameter)
        {
            return stateMachine.TryHandleAction(StateMachine.FlmScanAction.EActionDoorContactOpen);            
        }

        public event EventHandler CanExecuteChanged;
    };
}
